From 14f8feec060ac99c34978944d3dcda89788f897a Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Sun, 3 May 2026 14:47:37 +0100 Subject: [PATCH] Install and use sysusers.d/tmpfiles.d config files sysusers.d/tmpfiles.d config files allow a package to use declarative configuration instead of manually written maintainer scripts. This also allows image-based systems to be created with /usr/ only, and also allows for factory resetting a system and recreating /etc/ on boot. https://www.freedesktop.org/software/systemd/man/latest/sysusers.d.html --- debian/control | 3 ++- debian/dcmtk.postinst | 18 ------------------ debian/dcmtk.sysusers | 1 + debian/dcmtk.tmpfiles | 2 ++ 4 files changed, 5 insertions(+), 19 deletions(-) create mode 100644 debian/dcmtk.sysusers create mode 100644 debian/dcmtk.tmpfiles diff --git a/debian/control b/debian/control index 68ddd8bd..064af5eb 100644 --- a/debian/control +++ b/debian/control @@ -4,6 +4,7 @@ Uploaders: Gert Wollny , Mathieu Malaterre Section: science Build-Depends: cmake, debhelper-compat (= 13), + dh-sequence-installsysusers, dpkg-dev (>= 1.22.5), gettext, help2man, @@ -24,7 +25,7 @@ Homepage: https://dicom.offis.de/dcmtk Package: dcmtk Architecture: any -Depends: adduser, ${misc:Depends}, ${shlibs:Depends} +Depends: ${misc:Depends}, ${shlibs:Depends} Description: OFFIS DICOM toolkit command line utilities DCMTK includes a collection of libraries and applications for examining, constructing and converting DICOM image files, handling offline media, diff --git a/debian/dcmtk.postinst b/debian/dcmtk.postinst index 525636d9..4ed8adcd 100644 --- a/debian/dcmtk.postinst +++ b/debian/dcmtk.postinst @@ -2,24 +2,6 @@ set -e -# Create dcmtk user and group - -if ! getent passwd dcmtk >/dev/null 2>&1; then - if ! getent group dcmtk > /dev/null 2>&1; then - echo "Adding \`dcmtk' group to system ..." - addgroup --quiet --system dcmtk || true - fi - echo "Adding \`dcmtk' user to system ..." - adduser --quiet --system --ingroup dcmtk --home /var/lib/dcmtk/db \ - --shell /usr/sbin/nologin dcmtk || true -fi - -# work around possible adduser bug, see #119366 -[ -d /var/lib/dcmtk/db ] || mkdir -p /var/lib/dcmtk/db -chmod 755 /var/lib/dcmtk/db -chown -h dcmtk:dcmtk /var/lib/dcmtk/db || true - - # Handle imagectn -> dcmqrdb transition in (3.5.3 -> 3.5.4) diff --git a/debian/dcmtk.sysusers b/debian/dcmtk.sysusers new file mode 100644 index 00000000..149b92f9 --- /dev/null +++ b/debian/dcmtk.sysusers @@ -0,0 +1 @@ +u! dcmtk - - /var/lib/dcmtk/db /usr/sbin/nologin diff --git a/debian/dcmtk.tmpfiles b/debian/dcmtk.tmpfiles new file mode 100644 index 00000000..095d3a73 --- /dev/null +++ b/debian/dcmtk.tmpfiles @@ -0,0 +1,2 @@ +d /var/lib/dcmtk/db 0755 dcmtk dcmtk +Z /var/lib/dcmtk/db 0755 dcmtk dcmtk -- 2.30.2